#ifndef AVATARLIB_H
#define AVATARLIB_H

#include <QObject>
#include <QHash>
#include <QPixmap>
//维护头像，从本地文件Avatar文件夹中加载头像存放路径，维护Map表
//哈希表模型
//(QString,QPixmap)-->("xqq220502","./Avatar/xqq220502.jpg")-->>(OC,path)
class AvatarLib : public QObject
{
    Q_OBJECT
public:
    AvatarLib(AvatarLib&)=delete;
    AvatarLib& operator=(AvatarLib&)=delete;
    static AvatarLib* getInstance();
    QPixmap getAvatar(QString);
    void deleteAvatar(QString oc);
    void clearAvatar();
    void appendAvatar(const QString& useroc,const QString& path);
signals:
    void AvatarloadDone();
    //用户头像更新的喜好
    void s_avatarFresh();
    //头像追加的信号
    void s_avatarAppend();
public slots:
    void recvAvatar(const QHash<QString,QPixmap> result);
    void refreshUser(QString useroc);
private:
    AvatarLib(){};
    static AvatarLib* avatarlib;

    QHash<QString,QPixmap> ocavatar;
};

#endif // AVATARLIB_H
